import Vue from 'vue'
import { $POST, $DELETE, $PUT, $GET, $UploadFile } from '__UTILS__/http_request/request-method.js'
import VueConfig, {preffix} from '__CONFIG__/vue-config.js'
const disposeResFunName = VueConfig[preffix + 'REQUEST_DISPOSE'].name //获取到处理返回结果函数名
const disposeResFun = Vue.prototype[disposeResFunName] // 获取到了处理函数

//上传头像
export function uploadAvatar(data) {
  const API = 'files/avatar'
  return $UploadFile(API, data, disposeResFun)
}

//上传文章封面
export function uploadArticleCover(data) {
  const API = 'files/article_cover'
  return $UploadFile(API, data, disposeResFun)
}

//上传文章需要的图片
export function uploadArticleImage(data) {
  const API = 'files/article_image'
  return $UploadFile(API, data, disposeResFun)
}